<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%  
String path = request.getContextPath();  
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";  
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>${systemName }</title>
    <link rel="shortcut icon" href="<%=basePath %>resources/favicon.ico"> 
    <link href="<%=basePath %>resources/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="<%=basePath %>resources/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="<%=basePath %>resources/css/animate.min.css" rel="stylesheet">
    <link href="<%=basePath %>resources/css/style.min.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="wrapper" style="height:100%;">
        <div class="row">
        	<div class="col-sm-12" style="padding-left:0px;padding-right: 0px;">
	            <div class="ibox float-e-margins" style="margin-bottom:2px;border:1px transparent solid;">
	                <div class="ibox-content">
	                    <form role="form" id="form1" class="form-inline" target="iframe0" action="<%=basePath%>system/test/list">
	                        <div class="form-group" >
								<label>类别:</label> 
								<select class="form-control" name="categoryId" id="categoryIdSelect">
									<option value="">请选择...</option>
									<c:forEach items="${testCategoryDictList }" var="i">
										<c:if test="${i.parentId == 0 }">
											<option value="${i.id }">${i.name }</option>
										</c:if>
									</c:forEach>
								</select>&nbsp;&nbsp;
								<label>测试题:</label>
								<select class="form-control" name="categoryParentId" id="categorySubSelect">
									<option value="">请选择...</option>
									<c:forEach items="${testCategoryDictList }" var="i">
									<option value="${i.id }">${i.name }</option>
									</c:forEach>
								</select>&nbsp;&nbsp;
								<button class="btn-primary" type="submit">搜索</button>&nbsp;&nbsp;
								<button class="btn-success" type="button">添加测试题目</button>
							</div>
	                    </form>
	                </div>
	            </div>
            </div>
        </div>
        <div class="row" id="content-main" style="height: calc(100% - 80px);">
			<iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="" frameborder="0"
				data-id="" seamless></iframe>
		</div>
    </div>
    <script src="<%=basePath %>resources/js/jquery.min.js?v=2.1.4"></script>
    <script src="<%=basePath %>resources/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="<%=basePath %>resources/js/content.min.js?v=1.0.0"></script>
</body>
<script type="text/javascript">
$(function(){
	$("#form1").submit();
	
	$('#categoryIdSelect').change(function() {
		var parentId = $(this).children('option:selected').val();
		$.post("<%=basePath%>system/test/category_dict/query",{parentId:parentId},function(result){
			jQuery("#categorySubSelect").empty();
			jQuery("#categorySubSelect").append("<option value=''>请选择...</option>");
			for(var i = 0;i < result.itemList.length ; i++){
				var item = result.itemList[i];
				jQuery("#categorySubSelect").append("<option value='"+item.id+"'>"+item.name+"</option>");
			}
		});
	})
});
</script>
</html>
